package managers.socialNetworkManagers;

import java.io.IOException;
import java.sql.SQLException;
import java.util.ResourceBundle;

import utils.StackTracePrinter;

import managers.DBManager;


public class UpdateMiniaturesService extends PeriodicService {

	private static final int DEFAULT_UPDATE_PERIOD = 900000; //15 minutes;

	public UpdateMiniaturesService() {
		this(DEFAULT_UPDATE_PERIOD);
	}

	public UpdateMiniaturesService(int period) {
		super("UpdateMiniatures", period);
	}

	@Override
	public void run() {
		try {
			SocialDataUpdateMethods.updateMiniatures(DBManager.getConnection(), manager);
		} catch (SQLException e) {
			SocialNetworkManager.getSharedInstance().getFeedbackManager().updateStatus(ResourceBundle.getBundle("managers.socialNetworkManagers.messages").getString("m.1"), SocialNetworkFeedbackManager.WARNING);
			StackTracePrinter.print(e);
		} catch (IOException e) {
			SocialNetworkManager.getSharedInstance().getFeedbackManager().updateStatus(ResourceBundle.getBundle("managers.socialNetworkManagers.messages").getString("m.1"), SocialNetworkFeedbackManager.WARNING);
			StackTracePrinter.print(e);
		}



	}

}
